# !/usr/bin/env python
# -*- coding: utf-8 -*-
# @File  : 工具创建-@tool 装饰器(注释).py
# @Author: dongguangwen
# @Date  : 2025-03-23 21:14
from langchain_core.tools import tool
from typing import Annotated, List


@tool
def multiply_by_max(
    a: Annotated[str, "scale factor"],
    b: Annotated[List[int], "list of ints over which to take maximum"],
) -> int:
    """Multiply a by the maximum of b."""
    return a * max(b)


ret = multiply_by_max.args_schema.schema()
print(ret)

"""
{'description': 'Multiply a by the maximum of b.', 'properties': {'a': {'description': 'scale factor', 'title': 'A', 'type': 'string'}, 'b': {'description': 'list of ints over which to take maximum', 'items': {'type': 'integer'}, 'title': 'B', 'type': 'array'}}, 'required': ['a', 'b'], 'title': 'multiply_by_max', 'type': 'object'}
"""